package com.woniuxy01;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author 作者
 * @create 2025-06-06 10:28
 */
public class Test02 {

    public static void main(String[] args) {
        Date date = stringToDate("2000-1a-1");
        System.out.println(date);
    }

    public static Date stringToDate(String str){
        try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date date = sdf.parse(str);
            return date;
        } catch (ParseException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
}
